import "./assets/reset.css";
import "./assets/border.css";
import "./assets/main.scss";
import 'element-plus/theme-chalk/dark/css-vars.css'
//轻提示的
import 'element-plus/es/components/message/style/css'

import * as ElementPlusIconsVue from "@element-plus/icons-vue";

import { createApp } from "vue";
import { createPinia } from "pinia";
import router from "./router";
//自定义语言包
import { createI18n } from "vue-i18n";
import zh from "@/i18n/zh.js";
import en from "@/i18n/en.js";
import App from "./App.vue";

// 创建App
const app = createApp(App);

app.use(createPinia()); //管理数据的仓库
app.use(router); //路由

//配置vue-i18n的插件
const i18n = createI18n({
  //默认语言是用户选择的语言，如果读取不到就默认中文
  locale: localStorage.getItem("language") || "zh",
  //fallbackLocale备选方案，locale加载不出来，就执行fallbackLocale
  fallbackLocale: "zh",
  legacy: false,
  messages: {
    zh: zh,
    en: en,
  },
});
app.use(i18n);

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

// 挂载App
app.mount("#app");
